package com.gome.ocean.service.gddl.impl;

import java.util.List;

import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.Page;
import com.gome.ocean.dao.gddl.AppRuleDAO;
import com.gome.ocean.dao.model.gddl.AppRuleBO;
import com.gome.ocean.service.gddl.AppRuleService;

@Service("appRuleService")
@Transactional("transactionManager")
public class AppRuleServiceImpl implements AppRuleService {

    @Autowired
    private AppRuleDAO appRuleDao;

    @Override
    public boolean insertAppRuleBO(AppRuleBO appRuleBO) {
        return appRuleDao.insertAppRuleBO(appRuleBO) > 0;
    }

    @Override
    public boolean removeAppRuleBOById(Long id) {
        return appRuleDao.removeAppRuleBOById(id) > 0;
    }

    @Override
    public boolean updateAppRuleBOById(AppRuleBO appRuleBO) {
        return appRuleDao.updateAppRuleBOById(appRuleBO) > 0;
    }

    @Override
    public AppRuleBO findAppRuleBOById(Long id) {
        return appRuleDao.findAppRuleBOById(id);
    }

    @Override
    public AppRuleBO findAppRuleBOByAppIdAndExpression(Long appTableId, String expression) {
        return appRuleDao.findAppRuleBOByAppIdAndExpression(appTableId, expression);
    }

    @Override
    public Page<AppRuleBO> findAppRuleByAppId(Long appTableId, Integer pageNum, Integer pageSize) {
        return (Page) appRuleDao.findAppRuleByAppId(appTableId, new RowBounds(pageNum, pageSize));
    }

    @Override
    public List<AppRuleBO> findAllAppRuleBO() {
        return appRuleDao.findAllAppRuleBO();
    }

    @Override
    public List<AppRuleBO> findAppRuleListByAppId(Long appTableId) {
        return appRuleDao.findAppRuleListByAppId(appTableId);
    }

}
